<?php
namespace Home\Model;
use Think\Model;
class MemberModel extends Model {
    public function getSellerInfo($cond){

        if(!$cond){
    		return false;
    	}
    	$res = M('member')->join('join ecm_store on ecm_member.user_id = ecm_store.store_id')->where($cond)
    		->find();
    	return $res;
    }
    public function getMemberCount($cond){
        if(!$cond){
            return false;
        }
        $res = M('member')->field("count(*) as sum,FROM_UNIXTIME(reg_time, '%Y-%m-%d') as date")
            ->group('date')
            ->where($cond)
            ->select();

        return $res;
    }
    public function getAdminInfo($cond){
        if(!$cond){
            return false;
        }
        $res = M('member')->join('ecm_user_priv on ecm_member.user_id = ecm_member.user_id')->where($cond)
            ->find();
        return $res;
    }

    public function insertSellerInfo($data){
        if(!$data){
            return false;
        }
        $res = M('member')->add($data);
        return $res;
    }

    public function reviseSellerInfo($cond,$data){
        if(!$cond || !$data){
            return false;
        }
        $res = M('member')->where($cond)->save($data);
        return $res;
    }

}